<?php   
$dbHost = $_POST['dbHost'];  
$dbName = $_POST['dbName'];  
$dbUsername = $_POST['dbUsername'];  
$dbPassword = $_POST['dbPassword'];  
  $sqlFile = './inl.sql';  
$conn = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);  
if ($conn->connect_error) {  
    die("连接失败: " . $conn->connect_error);  
} 
	$lines = file($sqlFile);  
	$successCount = 0; 
	foreach ($lines as $line) {   
	    $sql = trim($line);  
	    if (substr($sql, -1) == ';') {  
	        if ($conn->query($sql) === TRUE) {  
	                 $successCount++;  
	               }
				   }
				   }
		   if ($successCount > 0) {  
			require '../config.php';
			$linkf= '../config.php';
			$ncc = "  
			<?php  
			\$db_host = '$dbHost';    
			\$db_user = '$dbUsername';    
			\$db_pass = '$dbPassword';    
			\$db_name = '$dbName';    
			?>";  
			file_put_contents($linkf, $ncc);
			       echo "success";
		   } else {  
		       echo "error";
		   }  
 $conn->close();   
?>